package com.roadjava.rbac.bean.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.roadjava.rbac.bean.converter.ResourceTypeConverter;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * 资源实体类
 * @author 怨九己
 */
@Data
@Entity
@Table(name = "resource")
public class Resource {
    /**
     * 资源ID
     */
    @ExcelProperty(value = "资源ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer resourceId;
    /**
     * 资源类型
     */
    @ExcelProperty(value = "资源类型",converter = ResourceTypeConverter.class)
    @NotNull(message = "资源类型不能为空")
    private String resourceType;
    /**
     * 资源描述
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "资源描述")
    private String resourceDescription;
    /**
     * 用户ID
     */
    @ExcelProperty(value = "上传用户ID")
    @NotNull(message = "上传用户ID不能为空")
    private Long userId;
    /**
     * 资源名称
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "资源名称")
    @NotNull(message = "资源名称不能为空")
    private String resourceName;
    /**
     * 封面名称
     */
    @ExcelIgnore
    private String coverName;
    /**
     * 标签
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "标签")
    private String tag;
}